package com.ticket.service.impl;

import com.ticket.dao.CinemaDao;
import com.ticket.dao.impl.CinemaDaoImpl;
import com.ticket.entity.Cinema;
import com.ticket.service.CinemaService;
import com.ticket.util.MybatisUtil;
import com.ticket.util.Page;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

/**
 * @author XuGuoZhi
 * @version 8.0
 * @description TODO 影院业务层实现类
 * @date 2023/10/7
 */
public class CinemaServiceImpl implements CinemaService {
    static CinemaDao cd;
    static{
        SqlSession session=MybatisUtil.getSqlSession();
        cd=session.getMapper(CinemaDao.class);
    }
    /**
     * @description TODO 影院分页业务查询实现
     * @author XuGuoZhi
     * @date 2023/10/7 19:15
      * @param page
     * @return org.t69.auction.Page<com.ticket.entity.Cinema>
     */
    @Override
    public Page<Cinema> selPageCinema(Page page,String cinemaName) {
        int count= cd.selPageCinemaCount(cinemaName);
        List<Cinema> cinemaPage=cd.selPageCinema(page,cinemaName);
        page.setTotalCount(count);
        page.setDataList(cinemaPage);
        return page;
    }
}
